package CS4310.csueb.visual;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import CS4310.csueb.items.Food;

public class FoodItem extends JPanel
{
	private JLabel itemName;
	private JButton useItem;
	
	public FoodItem(Food f)
	{
		itemName = new JLabel(f.toString());
		useItem = new JButton("consume");
		useItem.setPreferredSize(new Dimension(95, 20));
		
		this.setPreferredSize(new Dimension(200, 25));
		this.setLayout(new FlowLayout(FlowLayout.LEFT));
		this.add(itemName);
		this.add(useItem);
	}
	
	public void addActionListener(ActionListener arg0)
	{
		useItem.addActionListener(arg0);
		useItem.setActionCommand(itemName.getText());
	}
}
